package com.dk.service.impl;

import com.dk.mapper.TCountryMapper;
import com.dk.pojo.TCountry;
import com.dk.pojo.TCountryExample;
import com.dk.service.TCountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TCountryServiceImpl implements TCountryService {
    @Autowired
    private TCountryMapper tCountryMapper;

    @Override
    public List<TCountry> getInfo(Integer pid) {
        TCountryExample example = new TCountryExample();
        TCountryExample.Criteria criteria = example.createCriteria();
        criteria.andPidEqualTo(pid);
        return tCountryMapper.selectByExample(example);
    }

    @Override
    public List<TCountry> getCountry() {
        TCountryExample example = new TCountryExample();
        TCountryExample.Criteria criteria = example.createCriteria();
        criteria.andPidEqualTo(0);
        return tCountryMapper.selectByExample(example);
    }

    @Override
    public List<TCountry> getSheng(Integer guoId) {
        TCountryExample example = new TCountryExample();
        TCountryExample.Criteria criteria = example.createCriteria();
        criteria.andPidEqualTo(guoId);
        return tCountryMapper.selectByExample(example);
    }

    @Override
    public List<TCountry> getShi(Integer shiId) {
        TCountryExample example = new TCountryExample();
        TCountryExample.Criteria criteria = example.createCriteria();
        criteria.andPidEqualTo(shiId);
        return tCountryMapper.selectByExample(example);
    }
}
